<!DOCTYPE html>
<html lang="zh-cn">
	<head>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <title></title>
	    <#include "/common/meta.ftl"/>
		<script>
			$(function(){
				$("#cbAll").click(function(){
					$(".CK").prop('checked',$("#cbAll").prop('checked'));
				});
				<#if (flag!'')!=''>
				var msg = new top.$.zui.Messager('提示消息：${flag!''}', {
		                	type : 'success',
		                	fade : true,
		                	icon : 'ok-sign',
		                	time : 3000,
		                	scale : true
		    	});
				msg.show();
				</#if>
			});
			function hasChecked(){
				var cbs = $(".CK");
				for(var i=0;i<cbs.length;i++){
					if(cbs[i].checked == true){
						return true;
					}
				}
				return false;
			}
			function plDelete(){
				if(!hasChecked()){
					var msg = new top.$.zui.Messager('提示消息：请选择要批量删除的数据！', {
		                	type : 'warning',
		                	fade : true,
		                	icon : 'warning-sign',
		                	time : 3000,
		                	scale : true
			    	});
					msg.show();
				}else{
					if(confirm("您确定要删除这些数据吗？")){
						var cbs = $(".CK");
						var ids = "";
						for(var i=0;i<cbs.length;i++){
							if(cbs[i].checked == true){
								ids += cbs[i].value + ",";
							}
						}
						ids = ids.substring(0,ids.length-1);
						location.href = "./configDelete?ids="+ids;
					}
				}
			}
			function add(){
				location.href = "./configForm";
			}
		</script>
	</head>
	<body style="padding:5px;">
		<form action="./config" method="post">
		<div style="margin-bottom:4px;">
			<button class="btn btn-primary" onclick="add();" type="button"><i class="icon icon-plus"></i> 添加配置</button>
			<button class="btn btn-danger" onclick="plDelete();" type="button"><i class="icon icon-trash"></i> 批量删除</button>
			
			<div style="float:right;margin-bottom:4px;">
			<div class="input-group" style="width:190px;">
		   <span class="input-group-addon">配置名称</span> <input name="configname" value="${configname!''}" type="text" class="form-control" style="width:170px;">
			  <span class="input-group-btn">
			    <button class="btn btn-primary" type="submit"><i class="icon icon-search"></i> 搜索</button>
			  </span>
			</div>
			</div>
		</div>
	
		<table class="table table-hover table-bordered table-condensed" style="margin:0px;">
		  	<thead>
		    	<tr>
		    		<th style="width:40px;text-align:center;"><input type="checkbox" name="cbAll" id="cbAll" /></th>
			      	<th style="text-align:center;width:220px;">配置名称</th>
			      	<th style="text-align:center;width:200px;">配置项</th>
			      	<th style="text-align:center;width:230px;">配置项值</th>
			      	<th style="text-align:center;">配置描述</th>
		    	</tr>
		  	</thead>
	  		<tbody>
	  			<#list data.records as x>
	  			<tr>
	  				<td style="text-align:center"><input type="checkbox" class="CK" value="${x.configid}"/></td>
			      	<td style="text-align:left"><a href="./configForm?id=${x.configid}">${x.configname?default('')}</a></td>
			      	<td style="text-align:left;">${x.configitem?default('')}</td>
			      	<td style="text-align:left;">${x.configitemvalue?default('')}</td>
			      	<td style="text-align:left">${x.configmemo?default('')}</td>
			    </tr>
			    </#list>
	  		</tbody>
		</table>
		<#include "/common/page_v1.ftl"/>
		</form>
	</body>
</html>